package com.younion.action.interactive.baidu.service;


import com.younion.action.interactive.baidu.api.BaiduMapApi;
import com.younion.action.interactive.baidu.model.BaiduMapResult;
import org.codehaus.jackson.map.ObjectMapper;


public class BaiduMapService {
	private BaiduMapApi api;
	/**
	 * 得到坐标
	 * 
	 * @return
	 * @throws Exception 
	 */
	public BaiduMapResult getBaiduMapResult(String address) throws Exception {
		api = new BaiduMapApi();
		BaiduMapResult result = null;
		String jsonData = api.getLocationByAddress(address);
		ObjectMapper mapper = new ObjectMapper();
		result = mapper.readValue(jsonData, BaiduMapResult.class);  
		return result;
	}
}
